package com.example.kspo_enjoysports;
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.example.kspo_enjoysports.vo.LocateVO;


public class LocateArrayAdapter extends ArrayAdapter<LocateVO> {

	Context context;
	ArrayList<LocateVO> items;
	LocateVO loVo;
	public LocateArrayAdapter(Context context, int resource,ArrayList<LocateVO> items) {
		super(context, resource, items);
		// TODO Auto-generated constructor stub
		this.context = context;
		this.items = items;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return items.size();
	}
	
	
	
	@Override
	public LocateVO getItem(int position) {
		// TODO Auto-generated method stub
		return items.get(position);
	}
	
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View v= convertView;
		
		if(v ==null)
		{
			LayoutInflater inflater = LayoutInflater.from(context);
			v =inflater.inflate(R.layout.simple_custom_item_txt, parent, false);
		}
			
		loVo = items.get(position);
		TextView txtv = (TextView)v;
		txtv.setText(loVo.locateName);
		return v;
	}
}
